<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../common/taglib.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">	
		<title>TzMarlon</title>
		<%@include file="../common/common.jsp" %>
		<link type="text/css" rel="stylesheet" href="${basePath}/resources/js/editer/themes/default/css/umeditor.css"></link>
		<script type="text/javascript" charset="utf-8" src="${basePath}/resources/js/editer/umeditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="${basePath}/resources/js/editer/umeditor.min.js"></script>
	</head>
	<body style="background:url(${basePath}/resources/images/bg2.jpg)">
		<!--头部-->
		<%@include file="../common/header.jsp" %>
		<!-- 内容区 -->
		<div class="wrapbox mt120">
			<div class="user-content">
				<p style="padding:20px;text-indent:2em;">文章标题：<input style="text-indent:1em;line-height:24px" type="text" id="title"  class="input" autofocus="autofocus" placeholder="请输入标题..." maxlength="20"></p>
			 	<div class="article-title">
			 		<textarea id="myEditor" class="text_area" style="height:300px;width:100%;text-indent:2em;" placeholder="请输入文章内容..."></textarea>
			 	</div>
			 	<p style="padding:20px;">关键字：<input style="text-indent:1em;line-height:24px;width:255px;border:0;" type="text" id="keyword"  class="input" autofocus="autofocus" placeholder="请输入关键字..."></p>
			 	<p style="padding:20px;">文章分类：<label><input type="radio" name="channel"/>前端</label><label><input type="radio" name="channel"/>后端</label></p>
			 	<p class="publish"><a href="javascript:volid(0)" onclick="saveComment()"><i class="iconfont icon-fabiao"></i>发表言论</a></p>
		    </div>
		</div>
	 <script type="text/javascript">
		var um = UM.getEditor("myEditor");
		//获取富文本编辑器的带有格式的内容
		function getEditoHtml(myEditor){
			return UM.getEditor(myEditor).getContent();
		}
		
		//获取富文本编辑器的纯文本内容
		function getEditText(myEditor){
			return UM.getEditor(myEditor).getContentTxt();
		}
		
		//给某个富文本框赋值
		function setEditorText(message,myEditor){
			 UM.getEditor(myEditor).setContent(message, false);//清空富文本编辑器
		}
		
		function saveComment(){
			var title = $("#title").val();
			var text = getEditoHtml("myEditor");
			var keyword = $("#keyword").val();
			var params = {
					title:title,
					text:text,
					keyword:keyword
			};
			$.ajax({
				type:"post",
				url:basePath + "/article/save.do",
				data:params,
				success:function(data){
					if(data=="success"){
						alert("保存成功！");
					}
				}
			});
		}
		
	</script>
	</body>
</html>
			 	